#ifndef __CLIENT_APP_CHECKTHREAD_included
#define __CLIENT_APP_CHECKTHREAD_included

#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include "../client-protocol/ConnectionControl.h"
#include"../engine/Queue.h"

enum {
	APP_ACTION_START = 0,
	APP_ACTION_EXIT,
	APP_ACTION_SYNC_FILE
};

namespace Client {
namespace App {

class CMessage {

public:

	int mWhat;

	CMessage(int what) : mWhat(what) { }

};

class CCheckThread {

	boost::shared_ptr<boost::thread> mThread;
	boost::shared_ptr<CConnectionControl> mControlConnection;
	Engine::CQueue<boost::shared_ptr<CMessage>> mMsgQueue;

	void MessageLoop();

public :
	
	CCheckThread();

	void Start();
	void SendEmptyMessage(int what);
	void Join() { if(mThread) mThread->join(); }
	void ApplyAuthCode(std::string& authcode);
};

} // Client
} // App
#endif //__CLIENT_APP_CHECKTHREAD_included